#{extends 'CRUD/layout.html' /}
#{set title:messages.get('medicinecardnosology.add') /}

<script type="text/javascript">
$(document).ready(function() {
	var beginDate = $('#object_beginDate').val();
	var datepicker = '#object_beginDate';
	$.datepicker.setDefaults($.extend({
		minDate: new Date(1900,0,1),
		maxDate: new Date(),
		yearRange: '1900:+00',
		changeMonth: true,
		changeYear: true},
		$.datepicker.regional['']));
	$(datepicker).datepicker();
	%{
		currentLanguage = play.i18n.Lang.get();
	}%
	$(datepicker).datepicker('option', $.datepicker.regional['&{currentLanguage}'.lenght == 0 ? 'en' : '&{currentLanguage}']);
	$(datepicker).datepicker('option', 'dateFormat', 'dd-mm-yy');
	$('#object_beginDate').val(beginDate);

	var endDate = $('#object_endDate').val();
	var endDatePicker = '#object_endDate';
	$(endDatePicker).datepicker();
	$(endDatePicker).datepicker('option', $.datepicker.regional['&{currentLanguage}'.lenght == 0 ? 'en' : '&{currentLanguage}']);
	$(endDatePicker).datepicker('option', 'dateFormat', 'dd-mm-yy');
	$('#object_endDate').val(endDate);
});
</script>

<div id="crudBlank" class="${type.name}">

    <h2 id="crudBlankTitle">&{'medicinecardnosology.add'}</h2>

    <div class="objectForm">
    #{form action:@create(), enctype:'multipart/form-data'}
        #{crud.form fields:['description', 'beginDate', 'endDate', 'active', 'nosology', 'medicineCard'] /}
        <p class="crudButtons">
            <input type="submit" name="_save" value="&{'crud.save', type.modelName}" />
            <input type="submit" name="_saveAndContinue" value="&{'crud.saveAndContinue', type.modelName}" />
            <input type="submit" name="_saveAndAddAnother" value="&{'crud.saveAndAddAnother', type.modelName}" />
        </p>
    #{/form}
    </div>

</div>